package com.HZNU;

import com.netflix.hystrix.contrib.metrics.eventstream.HystrixMetricsStreamServlet;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.ServletRegistrationBean;
import org.springframework.cloud.client.circuitbreaker.EnableCircuitBreaker;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.context.annotation.Bean;

@SpringBootApplication
@EnableEurekaClient //客户端 在服务启动后自动注册在eureka中
@EnableDiscoveryClient //观看注册信息的
@EnableCircuitBreaker //添加对熔断器支持
public class HystrixDeptApplication {
    public static void main(String[] args) {
        SpringApplication.run(HystrixDeptApplication.class,args);
    }
    //增加一个servlet
//    增加监控
    @Bean
    public ServletRegistrationBean a(){
        ServletRegistrationBean servletRegistrationBean = new ServletRegistrationBean(new HystrixMetricsStreamServlet());
        servletRegistrationBean.addUrlMappings("/actuator/hystrix.stream");
        return servletRegistrationBean;
    }
}

